
#pragma once
#include "ShaderNode.h"

class ShaderTexture : public ShaderNode
{
public:
	ShaderTexture(const std::string& fileName);
	virtual ~ShaderTexture() = default;

public:
	virtual bool isValid() { return getTexture() > 0; }
	virtual void release();

protected:
	void initWithFileName(const std::string& fileName);

public:
	PROPERTY_READONLY(GLuint, m_texture, Texture);
	PROPERTY_READONLY(int, m_width, Width);
	PROPERTY_READONLY(int, m_height, Height);

public:
	static std::shared_ptr<ShaderTexture> create(const std::string& fileName)
	{
		auto texture = std::make_shared<ShaderTexture>(fileName);
		return texture->isValid() ? texture : nullptr;
	}
};

typedef std::shared_ptr<ShaderTexture> ShaderTexturePtr;